/* eslint-disable */
// @ts-ignore
import request from '@/utils/request';
import { CustomRequestOptions } from '@/interceptors/request';

import * as API from './types';

/** 分页查询角色 GET /role */
export async function roleGetRolePage({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.RoleGetRolePageParams;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelResponseDataListModelRoleModel_>('/role', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 编辑角色 PUT /role */
export async function roleEditRole({
  params,
  body,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.RoleEditRoleParams;
  body: API.AddOrEditRoleModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/role', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    params: {
      ...params,
    },
    data: body,
    ...(options || {}),
  });
}

/** 新增角色 POST /role */
export async function roleAddRole({
  body,
  options,
}: {
  body: API.AddOrEditRoleModel;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/role', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除角色 DELETE /role */
export async function roleDeleteRole({
  params,
  options,
}: {
  // 叠加生成的Param类型 (非body参数openapi默认没有生成对象)
  params: API.RoleDeleteRoleParams;
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelObject_>('/role', {
    method: 'DELETE',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 查询角色列表 GET /role/list */
export async function roleGetRoles({
  options,
}: {
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelListRoleModel_>('/role/list', {
    method: 'GET',
    ...(options || {}),
  });
}

/** 查询模块权限树 GET /role/tree */
export async function roleGetModulePowerTree({
  options,
}: {
  options?: CustomRequestOptions;
}) {
  return request<API.ResponseModelListModulePowerTreeModel_>('/role/tree', {
    method: 'GET',
    ...(options || {}),
  });
}
